#include <stdio.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_ttf.h>
#include <SDL/SDL_mixer.h>
#include <assert.h>
#include "SDL\jeu.h"
#include "SDL\Sounds.h"
#include "SDL\chargement.h"
void Menu()
{
SDL_Surface *ecrandebut = NULL, *fond_base= NULL;
SDL_Rect position_fond_base;
int imgFlags = IMG_INIT_JPG|IMG_INIT_PNG|IMG_INIT_TIF; // Flags pour charger le support du JPG, PNG et TIF
int continuer=1,*pcontinuer,i=1;
pcontinuer=&continuer;
SDL_Color couleurNoire = {0, 0, 0},couleurBlanche = {255, 255, 255};



   SDL_Event event;
   position_fond_base.x=0;
   position_fond_base.y=0;
   SDL_Init(SDL_INIT_VIDEO);

if ( IMG_Init(imgFlags) != imgFlags )
    {
        fprintf(stderr,"Erreur lors de l'initialisation de la SDL_image : '%s'\n",IMG_GetError());
        return -1;
    }
   if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 1024) == -1) //Initialisation de l'API Mixer
   {
      printf("%s", Mix_GetError());
   }
    ecrandebut= SDL_SetVideoMode(700, 719, 16, SDL_HWSURFACE | SDL_DOUBLEBUF);

    fond_base= IMG_Load("debut1.jpg");

    SDL_BlitSurface(fond_base, NULL, ecrandebut,&position_fond_base);

    SDL_Flip(ecrandebut);
//MusiqueMenu();
    while (continuer)
    {
switch (i){
case 1 : fond_base= IMG_Load("debut1.jpg");break;
case 2 : fond_base= IMG_Load("debut2.jpg");break;
case 3 : fond_base= IMG_Load("debut3.jpg");break;
}
SDL_BlitSurface(fond_base, NULL, ecrandebut,&position_fond_base);
   SDL_Flip(ecrandebut);
    SDL_WaitEvent(&event);
    switch (event.type)
     {
      case SDL_QUIT : continuer=0;break;
   case SDL_KEYDOWN :
          switch(event.key.keysym.sym)
          {
case SDLK_UP :
if (i==1)
{
i=3;
}
else
{
i--;
}
break;
case SDLK_DOWN :
if (i==3)
{
i=1;
}
else
{
i++;
}
break;

case SDLK_RETURN :
switch (i){
case 1 : ChoixMap(1);break;
case 2 : /* Page A propos */break;
case 3 : continuer=0;break;
}
break;

         }



break;

     }
  SDL_FreeSurface(fond_base);

    }
    SDL_FreeSurface(ecrandebut);
    SDL_FreeSurface(fond_base);
    Mix_CloseAudio();
    TTF_Quit();
    SDL_Quit();
}



